package com.qk.management.mapper;

import com.qk.dto.activity.ActivityListDTO;
import com.qk.entity.Activity;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author diva
 * @date 2025/10/9 14:53
 * @ProjectName
 */

@Mapper
public interface ActivityMapper {
    @Delete("delete from activity where id = #{id}")
    void delete(Integer id);
    @Insert("insert into activity(channel,name,start_time,end_time,description,type,discount,voucher,create_time,update_time) values(#{channel},#{name},#{startTime},#{endTime},#{description},#{type},#{discount},#{voucher},#{createTime},#{updateTime})")
    void insert(Activity activity);
    @Select("select * from activity where id = #{id}")
    Activity selectByPrimaryKey(Integer id);
    @Update("update activity set name = #{name},start_time = #{startTime},end_time = #{endTime},description = #{description},type = #{type},discount = #{discount},voucher = #{voucher},update_time = #{updateTime} where id = #{id}")
    void updateByPrimaryKeySelective(Activity activity);
    @Select("select * from activity where type = #{type}")
    List<Activity> selectByType(Integer type);
    @Select("select * from activity limit #{page},#{pageSize}")
    List<Activity> selectByPage(ActivityListDTO dto);
}
